import mysql.connector
import redis

# MySQL 连接
db = mysql.connector.connect(
    host="localhost",
    user="root",
    password="password",
    database="test_db"
)

# Redis 连接
cache = redis.StrictRedis(host="localhost", port=6379, db=0)

def get_data_from_db():
    cursor = db.cursor(dictionary=True)
    cursor.execute("SELECT * FROM users")
    return cursor.fetchall()
